-
Notifications
You must be signed in to change notification settings - Fork 23
[PM-26354] Add methods to create rotateable key sets from PRF #494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #494 +/- ##
==========================================
+ Coverage 78.95% 79.02% +0.07%
==========================================
Files 296 298 +2
Lines 30904 31080 +176
==========================================
+ Hits 24400 24561 +161
- Misses 6504 6519 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2514070 to
32ca764
Compare
| }) | ||
| } | ||
|
|
||
| fn unlock<Ids: KeyIds>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is currently unused since we don't yet have plans to use the rotateable key set on mobile, only to create them. However, it implements functionality that is currently done in TypeScript that could be moved to the SDK.
I can remove it until we decide to either migrate the browser apps to this SDK method or start using it in the mobile apps.
| let pub_key = SpkiPublicKeyBytes::from(pub_key_bytes); | ||
| let encapsulation_key = AsymmetricPublicCryptoKey::from_der(&pub_key)?; | ||
| // TODO: There is no method to store only the public key in the store, so we | ||
| // have pull out the encryption key to encapsulate it manually. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I think this needs a KM-owned tech debt follow-up ticket. I'll make a jira ticket when this merges, but adding the APIs for this feels out of scope for an external PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look mostly good, thank you!
Only some minor questions / nits.
One more (optional) suggestion here would be to take test vectors from the TS clients and feed them into the unit tests so we know the implementation works the same way.
|
Thank you for the review!
I looked around the clients codebase, but I don't see a full test vector for an end-to-end (PRF, User Key) -> RotateableKeySet and back. There are mocked values that don't verify the actual cryptography in https://github.com/bitwarden/clients/blob/main/libs/auth/src/common/login-strategies/webauthn-login.strategy.spec.ts and https://github.com/bitwarden/clients/blob/main/libs/common/src/auth/services/webauthn-login/webauthn-login.service.spec.ts. The Rust types guarantee some of the other invariants tested in. Did you have some specific test vectors in mind? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I'd recommend moving RotateableKeySet into it's own file, since it is a different cryptographic construction. key_rotation.rs is really just meant for "User Key Rotation", which may interact with RotateableKeySets, but is a different use-case.
(As a KM note, key_rotation.rs should probably be renamed to user_key_rotation.rs)
|
Claude finished @iinuwa's task —— View job Code Review: Add methods to create rotateable key sets from PRFSummary of Changes Since Last ReviewThis PR adds functionality to create rotateable key sets from PRF (Pseudorandom Function) outputs for mobile unlock passkeys. The implementation consists of:
Recent commits addressed previous feedback:
Critical Issues1. Test Coverage Gap: Deterministic Test Data (
|
|
b9bb1f0 to
d33e203
Compare
d33e203 to
fef1668
Compare
|
I rebased and incorporated the changes mentioned by Bernd, squashed the lint fixes, and added some other commits to make CI all happy. This is ready for review. (I updated the Jira ticket to PM-26354 to separate it from the mobile work.) |
|
Looks like there are some new merge conflicts, other than that LGTM. |
|
Addressed feedback, and opened #537 to address failing test coverage step in CI. |




🎟️ Tracking
PM-26354
📔 Objective
In order to set up unlock passkeys on mobile clients, this PR adds a method to create a rotateable key set derived from a PRF value.
This is based on existing code in the TypeScript library and web vault:
⏰ Reminders before review
team
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmedissue and could potentially benefit from discussion
:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes